<div style="padding: 30px;" class="layui-form layui-form-pane">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">年度：</label>
            <div class="layui-input-inline seller-inline-4">
                <select name="year" lay-filter="draw_year" id="draw_year" lay-search>
                    <option value=""></option>
                    {volist name="yearList" id="yearList"}
                    <option value="{$yearList.id}">{$yearList.year}</option>
                    {/volist}
                </select>
            </div>
        </div> 
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">季度：</label>
            <div class="layui-input-inline seller-inline-4">
                <select name="season" lay-filter="draw_season" id="draw_season" lay-search>
                    <option value=""></option>
                    {volist name="seasonList" id="seasonList"}
                    <option value="{$seasonList.season_id}">{$seasonList.season_name}</option>
                    {/volist}
                </select>
            </div>	
        </div> 
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">部/院：</label>
            <div class="layui-input-inline seller-inline-4">
                <select name="dep_id" lay-filter="draw_dep_id" id="draw_dep_id" lay-search>
                    <option value=""></option> 
                    {volist name="deptList" id="deptList"}
                    <option value="{$deptList.bmdm}">{$deptList.bmmc}</option>
                    {/volist} 
                </select>
            </div>	
        </div>	
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">科教中心：</label>
            <div class="layui-input-inline seller-inline-4">
                <select name="draw_sub_center_id" lay-filter="draw_sub_center_id" id="draw_sub_center_id" lay-search>
                </select>
            </div>	
        </div>	
    </div>
    
    {:zlserverToken()}
    <button id="draw_save" style = "margin-top: 30px" class="layui-btn layui-btn-fluid draw-save-btn" lay-submit lay-filter="extra-draw">提交</button>
</div>
<style>
    .layui-unselect dl {max-width: 100px;}
    .layui-form-select dl {max-height: 120px;}
</style>
<script>
    layui.use('form', function(){
        $("#draw_year").val({$year});  // 年度：
        $("#draw_season").val({$season});  // 季度：
        $("#draw_dir").val(1);  // 默认方向：就业
        layui.form.render();
    });

    layui.use('form', function () {
        // 联动部门
        layui.form.on('select(draw_dep_id)', function (data) {
            getSubCenter(data);
        }); 
    });

    // 得到专业
    function getSubCenter(data) {
        $.ajax({
            type: 'get',
            url: "{:url('BookCommon/getSubCenter')}",
            data: 'deptId=' + data.value,
            success: function(e) {
                if(e.status) {
                    $("#draw_sub_center_id").empty();//清空下拉框的值
                    $('#draw_sub_center_id').append(new Option('', ''));// 下拉菜单里添加元素 
                    $.each(e.data, function (index, item) {
                        $('#draw_sub_center_id').append(new Option(item.name, item.id));// 下拉菜单里添加元素
                    });
                    layui.form.render("select");//重新渲染 固定写法
                } else {
                    layer.msg(e.msg);
                }
            }
        });
    };

</script>